<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <link rel="stylesheet" href="../static/bootstrap/css/bootstrap.css">
  <link rel="stylesheet" href="../static/bootstrap-table/bootstrap-table.css">
  <script src="../static/jquery/jquery-3.6.0.js"></script>
  <script src="../static/bootstrap/js/bootstrap.js"></script>
  <script src="../static/bootstrap-table/bootstrap-table.js"></script>
  <script src="../static/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>
</head>
<body>

<table
  id="table"
  data-toggle="table"
  data-height="460"
  data-show-footer="true"
  data-url="../json/data1.json">
  <thead>
    <tr>
      <th data-field="id" data-falign="left" data-footer-formatter="idFormatter">ID</th>
      <th data-field="name" data-falign="center" data-footer-formatter="nameFormatter">Item Name</th>
      <th data-field="price" data-falign="right" data-footer-formatter="priceFormatter">Item Price</th>
    </tr>
  </thead>
</table>

<script>
  function idFormatter() {
    return 'Total'
  }

  function nameFormatter(data) {
    return data.length
  }

  function priceFormatter(data) {
    var field = this.field
    return '$' + data.map(function (row) {
      return +row[field].substring(1)
    }).reduce(function (sum, i) {
      return sum + i
    }, 0)
  }
</script>
</body>
</html>
